package com.jack.leetcode.eachproblem_2020;

public class 有效的字母异味词 {

    public boolean isAnagram(String s, String t) {
        int m = s.length();
        int n = t.length();
        if(m != n){
            return false;
        }
        int[] sWrod = new int[26];
        int[] tWrod = new int[26];
        for(char c : s.toCharArray()){
            sWrod[c - 'a']++;
        }
        for(char c : t.toCharArray()){
            tWrod[c - 'a']++;
        }
        for(int i = 0;i < 26;i++){
            if(sWrod[i] != tWrod[i]){
                return false;
            }
        }
        return true;
    }
}
